﻿@using MH.Common;
@{
    var UserInfo = CacheTools.GetUserInfo();
}
<header class="header">
    <nav class="navbar navbar-default" id="navbar">
        <div class="container">
            <div class="header-topbar hidden-xs link-border">
                <ul class="site-nav topmenu">
                    @*<li><a href="tags.html">标签云</a></li>*@

                    <!--todo:读者墙，考虑对活跃用户排名前十排行榜-->
                    <li><a href="readers.html" rel="nofollow"><i class="fa fa-signal"></i> 读者墙</a></li>
                    <li><a href="links.html" rel="nofollow"><i class="fa fa-chain"></i> 友情链接</a></li>
                    <li><a data-toggle="modal" data-target="#Notice" rel="nofollow"><i class="fa fa-bullhorn"></i> 公告</a></li>
                    <li><a data-toggle="modal" data-target="#WeChat" rel="nofollow"><i class="fa fa-weixin"></i> 微信公众号</a></li>

                    @*<li class="dropdown">
                <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" rel="nofollow">关注本站 <span class="caret"></span></a>
                <ul class="dropdown-menu header-topbar-dropdown-menu">
                    <li><a data-toggle="modal" data-target="#WeChat" rel="nofollow"><i class="fa fa-weixin"></i> 微信公众号</a></li>
                    <li><a data-toggle="modal" data-target="#Notice" rel="nofollow"><i class="fa fa-rss"></i> 公告</a></li>
                </ul>
            </li>*@
                </ul>
                @if (UserInfo == null)
                {
                    <a data-toggle="modal" data-target="#loginModal" class="login" rel="nofollow">Hi,请登录</a>
                    <a href="javascript:;" class="register" rel="nofollow">我要注册</a>
                    <a href="" rel="nofollow">找回密码</a>
                }
                else
                {
                    <a href="javascript:;" class="register" rel="nofollow">@("Hi,"+ UserInfo.NickName)</a>
                }
            </div>
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#header-navbar" aria-expanded="false">
                    <span class="sr-only"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>
                </button>
                <h1 class="logo hvr-bounce-in">
                    <a href="" title="">
                        <img src="~/Assets/images/logo.png" alt="" style=" max-width:160px">
                    </a>
                </h1>
            </div>
            <div class="collapse navbar-collapse" id="header-navbar">
                <ul class="nav navbar-nav navbar-right" id="menu">
                    <li  area="" class="hidden-index active"><a asp-area="" asp-controller="Home" asp-action="Index">首页</a></li>
                    <li><a asp-area="" asp-controller="Article" asp-action="Index">我的文章</a></li>
                    <li><a asp-area="" asp-controller="Poll" asp-action="Index">我的投票</a></li>
                    @if (true)//(UserInfo != null)
                    {
                        <li area="User"><a asp-area="User" asp-controller="Account" asp-action="Index">个人设置</a></li>
                    }
                </ul>
                <form class="navbar-form visible-xs" action="/Search" method="post">
                    <div class="input-group">
                        <input type="text" name="keyword" class="form-control" placeholder="请输入关键字" maxlength="20" autocomplete="off">
                        <span class="input-group-btn">
                            <button class="btn btn-default btn-search" name="search" type="submit">搜索</button>
                        </span>
                    </div>
                </form>
            </div>
        </div>
    </nav>
</header>

<!--微信二维码模态框-->
<div class="modal fade user-select" id="WeChat" tabindex="-1" role="dialog" aria-labelledby="WeChatModalLabel">
    <div class="modal-dialog" role="document" style="margin-top:120px;max-width:280px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="WeChatModalLabel" style="cursor:default;">微信扫一扫</h4>
            </div>
            <div class="modal-body" style="text-align:center"> <img src="~/Assets/images/wx.jpg" alt="" style="cursor:pointer;" width="248" /> </div>
        </div>
    </div>
</div>

<!--公告 该功能正在日以继夜的开发中-->
<div class="modal fade user-select" id="Notice" tabindex="-1" role="dialog" aria-labelledby="areDevelopingModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="areDevelopingModalLabel" style="cursor:default;">该功能正在日以继夜的开发中…</h4>
            </div>
            <div class="modal-body">
                <img src="~/Assets/images/baoman/baoman_01.gif" alt="深思熟虑" />
                <p style="padding:15px 15px 15px 100px; position:absolute; top:15px; cursor:default;">很抱歉，程序猿正在日以继夜的开发此功能，本程序将会在以后的版本中持续完善！</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal">朕已阅</button>
            </div>
        </div>
    </div>
</div>
<!--登录注册模态框-->
<div class="modal fade user-select" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="loginModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <form action="/Admin/Index/login" method="post">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="loginModalLabel">登录</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label for="loginModalUserNmae">用户名</label>
                        <input type="text" class="form-control" id="loginModalUserNmae" placeholder="请输入用户名" autofocus maxlength="15" autocomplete="off" required>
                    </div>
                    <div class="form-group">
                        <label for="loginModalUserPwd">密码</label>
                        <input type="password" class="form-control" id="loginModalUserPwd" placeholder="请输入密码" maxlength="18" autocomplete="off" required>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-primary">登录</button>
                </div>
            </form>
        </div>
    </div>
</div>

<!--右键菜单列表-->
<div id="rightClickMenu">
    <ul class="list-group rightClickMenuList">
        <li class="list-group-item disabled">欢迎访问信息助手官网</li>
        @*<li class="list-group-item"><span>IP：</span>172.16.10.129</li>
            <li class="list-group-item"><span>地址：</span>河南省郑州市</li>
            <li class="list-group-item"><span>系统：</span>Windows10 </li>
            <li class="list-group-item"><span>浏览器：</span>Chrome47</li>*@
    </ul>
</div>
<script type="text/javascript">
    //渲染一级菜单被选中的样式
    $(function () {
        var area = window.location.pathname.split("/")[1];
        var liArr = $("#menu").find("li");
        $.each(liArr, function () {
            console.log($(this).html());
            if ($(this).attr("area") == area) {
                $(this).addClass("hidden-index active");
            }
            else {
                $(this).removeClass("hidden-index active");
            }
        });
    });
</script>